<?php

namespace app\index\model;

use think\Cache;
use think\Db;
use think\Model;

class QjMsgLogModel extends Model
{

    public function addMsgLog($data)
    {
        $res['success'] = false;
        $res['desc'] = '添加失败';
        $res['errorcode'] = '200022';
        $ret = Db::table('qj_msg_log')->insert($data);
        if ($ret) {
            $id = Db::table('qj_msg_log')->getLastInsID();
            $res['success'] = true;
            $res['desc'] = '添加成功';
            $res['data']['msgId'] = $id;
            $res['errorcode'] = '';
        }
        return $res;
    }


    public function getMsgLogInfo($msg_id)
    {
        $info = Db::table('qj_msg_log')->where(['id' => $msg_id])->order('id desc')->find();
        $res['success'] = true;
        $res['desc'] = '';
        $res['errorcode'] = '';
        $res['data'] = $info;
        return $res;
    }
}
